/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import model.Guest;
import persistence.GuestDAO;

/**
 *
 * @author Martin Mohr Pedersen
 */
public class GuestController {

    public Guest findGuest(String cpr) {
        GuestDAO dao = new GuestDAO();
        return dao.findByCpr(cpr);
    }

    public void registerGuest(String cpr, String name) {
        
        cpr = cpr.replace("-", "");
        
        Guest guest = new Guest();
        guest.parseCpr(cpr);
        guest.setName(name);
        
        GuestDAO guestDao = new GuestDAO();
        guestDao.create(guest);
    }
}
